package com.objecteffects.template.tumblr.method;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.validation.Valid;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;

/**
 * @author Rusty Wright
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
public class Photo {
    private final String caption;
    private final List<Size> altSizes;
    private final Size originalSize;

    private final Map<String, Object> additionalProperties = new HashMap<>();

    public Photo(@JsonProperty("caption")
    final String _caption, @JsonProperty("alt_sizes")
    @Valid
    final List<Size> _altSizes, @JsonProperty("original_size")
    @Valid
    final Size _originalSize) {
        this.caption = _caption;
        this.altSizes = _altSizes;
        this.originalSize = _originalSize;
    }

    @JsonProperty("caption")
    public String getCaption() {
        return this.caption;
    }

    @JsonProperty("alt_sizes")
    public List<Size> getAltSizes() {
        return this.altSizes;
    }

    @JsonProperty("original_size")
    public Size getOriginalSize() {
        return this.originalSize;
    }

    @JsonAnyGetter
    public Map<String, Object> getAdditionalProperties() {
        return this.additionalProperties;
    }

    @JsonAnySetter
    public void setAdditionalProperty(final String name, final Object value) {
        this.additionalProperties.put(name, value);
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }

    @Override
    public int hashCode() {
        return HashCodeBuilder.reflectionHashCode(this);
    }

    @Override
    public boolean equals(final Object other) {
        return EqualsBuilder.reflectionEquals(this, other);
    }
}
